package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.Comment;
import com.cskaoyan.bean.ListData;
import com.cskaoyan.service.AdminCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.net.InetAddress;
import java.util.List;

/**
 * @author xudengfeng
 * @date 2020/12/6 15:42
 */

@RestController
@RequestMapping("admin/comment")
public class AdminCommentController {

    @Autowired
    AdminCommentService adminCommentService;

    @GetMapping("list")
    public BaseRespVo commentList(Integer page, Integer limit, String sort, String order, Integer userId, Integer valueId) {
        ListData<Comment> commentListData = adminCommentService.queryComment(page, limit, sort, order, userId, valueId);
        return BaseRespVo.ok(commentListData);
    }

    @PostMapping("delete")
    public BaseRespVo deleteComment(@RequestBody Comment comment) {
        //评论表的id
        Integer id = comment.getId();
        int i = adminCommentService.deleteCommentById(id);
        return BaseRespVo.ok();
    }

}
